package czh.cocoa.graphics;

import czh.cocoa.foundation.NSObject;
import czh.cocoa.foundation.NSString;

public class CGPoint extends NSObject {

	public float x;
	
	public float y;
	
	public CGPoint() {
		this(0,0);
	}
	
	public CGPoint(float x, float y) {
		this.x = x;
		this.y = y;
	}
	
	public CGPoint(CGPoint point) {
		this.x = point.x;
		this.y = point.y;
	}

	public void offset(float tx, float ty) {
		x += tx;
		y += ty;
	}
	
	public CGPoint clone() {
		return new CGPoint(x, y);
	}
	
	public boolean isEqual(NSObject o) {
		if(o instanceof CGPoint) {
			CGPoint other = (CGPoint) o;
			return x == other.x && y == other.y;
		}
		return false;
	}
	
	public NSString description() {
		return NSTR("(" + x + "," + y + ")");
	}
	
	public static CGPoint CGPointMake(float x, float y) {
		return new CGPoint(x, y);
	}
	
}
